#include <game/services/ApplicationService.h>
#include <lib3d/Application.h>
#include <system/assert.h>

ARELLO_GAME_NAMESPACE_DECL_START
namespace services {

ApplicationService::ApplicationService(liba::lib3d::Application* app)
	: application(app)
	, isLoading(false)
{
	LIBA_ASSERT(this->application);
}

void ApplicationService::ForceLoadingScreen()
{
	this->application->force_display_load_animation();
	this->isLoading = true;
	this->loadingStarted();
}

void ApplicationService::InvokeLoadingStarted() 
{
	if (!this->isLoading)
	{
		this->isLoading = true;
		this->loadingStarted();
	}
}

void ApplicationService::InvokeLoadingFinished() 
{ 
	this->isLoading = false;
	this->loadingFinished();
}

} // namespace services
ARELLO_GAME_NAMESPACE_DECL_END